﻿using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ThemeDemo
{
  /// <summary>
  /// Interaction logic for MainWindow.xaml
  /// </summary>
  public partial class MainWindow : Window
  {
    public MainWindow()
    {
      InitializeComponent();
      StateChanged += MainWindow_StateChanged;
    }

    private void MainWindow_StateChanged(object? sender, EventArgs e)
    {
      ToggleMaximizeRestoreButtons();
    }

    private void ToggleMaximizeRestoreButtons()
    {
      if (this.WindowState == WindowState.Maximized)
      {
        MaxButton.Visibility = Visibility.Collapsed;
        RestoreButton.Visibility = Visibility.Visible;
      }
      else
      {
        MaxButton.Visibility = Visibility.Visible;
        RestoreButton.Visibility = Visibility.Collapsed;
      }
    }

    private void DrogBorder_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
      if (e.LeftButton == MouseButtonState.Pressed)
      {
        this.DragMove();
      }
    }

    private void MinimizeButton_Click(object sender, RoutedEventArgs e)
    {
      this.WindowState = WindowState.Minimized;
    }

    private void CloseButton_Click(object sender, RoutedEventArgs e)
    {
      Application.Current.Shutdown();
    }

    private void MaxButton_Click(object sender, RoutedEventArgs e)
    {
      this.WindowState = WindowState.Maximized;
    }

    private void RestoreButton_Click(object sender, RoutedEventArgs e)
    {
      this.WindowState = WindowState.Normal;
    }


  }
}